from django.shortcuts import render, redirect
from workDjango import models
from django.utils.safestring import mark_safe
from django import forms
from django.core.validators import RegexValidator, ValidationError

class ManagerLoginForm(forms.Form):
    # 由于使用了ModelForm组件，无法在html文件中设立样式
    # 在这里设置相关的样式
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        # 循环找到所有的插件，添加样式
        for name, field in self.fields.items():
            if field.widget.attrs:
                field.widget.attrs["class"] = "form-control"
                field.widget.attrs["placeholder"] = field.label
            else:
                field.widget.attrs = {"class": "form-control", "placeholder": field.label}